<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="../inc_min.jsp"></jsp:include>
		
		<meta http-equiv="X-UA-Compatible" content="edge" />
		<title>账户佣金账期配置-编辑</title>
		<style>
		  ul,li{
            list-style: none;
        }
        a{
            text-decoration: none;
        }
       /* .controlSize{

            min-height:100px;
            _height:100px;
            padding:0;
        }*/
       
   		
   		#tb{
   		overflow:hidden;
   		width:90%;
   		}
   		#tb ul{
   		float:left;
   		padding-left:0px;
   		}
   		#tb .list{
   		width:150px;
   		text-align:center;
   		color:#3989c8;
   		}
   		#supplierName{
   			font-size:14px;
   			font-weight:bold;
   		}
   		table{
   			margin:0 auto;
   		}
   		td{
   			height:40px;
   		}
   		#tb ul li{
   		border:1px solid #dcdcdc;
   		font-size:12px;
   		height:30px;
   		line-height:30px;
   		}
   		#tb .list_li li{
   		  text-align:center;
   		  border-left:none;
   		  padding-left:30px;
   		  padding-right:30px;
   		}
   		.impt{
   		margin-top:5px;
   		margin-bottom:5px;
   		}
   		.impt li{
   		  width:505px;
   		  height:30px;
   		  line-height:30px;
   		}
   		.textbox{
            height: 20px;
            margin: 0;
            padding: 0 2px;
            box-sizing: content-box;
            border: 1px solid #95B8E7;
            vertical-align: middle;

        }
        .blue_btn{
            border: none;
            border-radius: 3px;
            background-color: #3989c8;
            padding: 10px 10px;
            margin-right:5px;
            color:#fff;
        }
        .sub_btn{
        	width:64px;
            border: none;
            border-radius: 3px;
            background-color: #ff8800;
            padding: 6px 6px;
            margin-right:10px;
            color:#fff;
        }
        .cancel_btn{
        	width:64px;
            border: none;
            border-radius: 3px;
            padding: 6px 6px;
            background: #999999;
            margin-right:10px;
            color:white;
        }
        .panel combo-p{
        	position: absolute;
        	bottom:0;
        	
        }
       #tb .list li + li{
   		 border-top:0px;  
   		}
   		#tb .list_li li + li{
   		 border-top:0px;  
   		}
		</style>
		<script type="text/javascript">
		$(function(){
			//初始化页面
			$.ajax({
				type:"get",
				url:'${ctx}/charges/getById/${param.id}?temp='+Math.random(),
				dataType:'json',
				async:true,
				success:function(data){
					if(data.success){
						$("#supplierName").text("供应商:"+data.obj.supplierName); //供应商
						$("#creditTime").val(CommonConverter.toEmptyString(data.obj.creditTime));  //账期时长
						$("#rate").val(data.obj.rate); //佣金率
					}
				}
			});
			
		});
		
		
		
		function auditPay(){
			progressLoad();
			var isValid = $('#dataForm').form('validate');
			if (!isValid) {
				progressClose();
				return;
			}
			
			var param={};//存储所有参数
			var rate = $("#rate").val(); //佣金率
			var obj = document.getElementById("creditOrver");
			var creditOrver = obj.options[obj.selectedIndex].text; //获取账期结点字符串内容
			var creditTime = $("#creditTime").val(); //账期时长
			
			param={
					"id":"${param.id}",
					"rate":rate,
					"creditOrver":creditOrver,
					"creditTime":creditTime
					};
			
			//发送ajax请求  
			$.ajax({
				type:"post",
			 	url:"${ctx}/charges/updateChannel?temp="+Math.random(),
				dataType:'json',
				//contentType:'application/json;charset=utf-8',
				data:param,
				success:function(data){
					progressClose();
					if(data.success){
						layer.alert('编辑成功！',{skin:'layui-layer-lan',title: ['系统提示', 'background-color:#00B2EE; color:#fff;'],closeBtn: 0}, function(index){
							closeWin();
							layer.close(index);
						});
					}else{
						layer.alert("编辑失败！");
					}
				},
				error:function(msg){
					progressClose();
					layer.alert("请检查您的网络，并重试！");
				}
			});
		}
		</script>
	</head>
	<body style="padding-left:10px;padding-top:0px;">
	<div id="tb">
		<h3 id="supplierName"></h3>
     </div> 
    <form id="dataForm">
       <table border="0" style="margin-bottom: 50px">
       	<tr>
       		<td align="right">佣金率：</td>
       		<td>
       		<input id="rate" style="width:295px;height:20px" type='text' class="easyui-validatebox easyui-numberbox textbox" data-options="'required':true"/>%
       		</td>
       	</tr>
       	<tr>
       		<td align="right">账期结点：</td>
       		<td>
       			<select id="creditOrver" style="width:300px;height:25px;" class="textbox" selected="selected">
                    <option value="1">出票完成</option>
                </select>
       		</td>
       	</tr>
       	<tr>
       		<td align="right">账期时长（天）：</td>
       		<td>
       		<input id="creditTime" style="width:295px;height:20px" type='text' class="easyui-validatebox easyui-numberbox textbox" data-options="'required':true"/>
       		</td>
       	</tr>
       	<tr>
       		<td colspan="2" align="center">
       			<input type="button" value="提交" class="sub_btn" id="submit" onclick="auditPay()"/>
       			<input type="button" value="取消" class="cancel_btn" id="close" onclick="closeWin()"/>
       		</td>
       	</tr>
       </table>
  	 </form>
	</body>
	<link rel="stylesheet" href="${ctx}/jslib/layui/css/layui.css" media="all"/>
	<script type="text/javascript" src="${ctx}/jslib/layer/layer.js" charset="utf-8"/>
</html>